<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/3/21 0021
 * Time: 下午 2:23
 */

namespace Home\Controller;


class SearchController extends NavController
{
        public function cat_search(){
            $catId = I('get.cat_id');
            $goodsModel = D('Admin/Goods');
            $data = $goodsModel->cat_search($catId);
            $catModel = D('Admin/Category');
            $searchFilter = $catModel->getSearchConditonByGoodsId($data['goods_id']);
            $goods2  = $goodsModel->getRecGoods('is_new');
            $goods3  = $goodsModel->getRecGoods('is_hot');
            $this->assign(array(
                'goods3' => $goods3,
                'goods2' => $goods2,
                'page' =>$data['page'],
                'data'=>$data['data'],
                'searchFilter'=>$searchFilter,
                '_page_title'=>'分类搜索页',
                '_page_keywords'=>'分类搜索页',
                '_page_description'=>'分类搜索页'
            ));
            $this->display();
        }
    public function key_search(){
       $key = I('get.key');
        $goodsModel = D('Admin/Goods');
        $data = $goodsModel->key_search($key);
        $catModel = D('Admin/Category');
        $searchFilter = $catModel->getSearchConditonByGoodsId($data['goods_id']);
        $this->assign(array(
            'page' =>$data['page'],
            'data'=>$data['data'],
            'searchFilter'=>$searchFilter,
            '_page_title'=>'分类搜索页',
            '_page_keywords'=>'分类搜索页',
            '_page_description'=>'分类搜索页'
        ));
        $this->display();
    }

}